package cn.edu.gzist.chapter03.web.config;

import cn.edu.gzist.chapter03.web.FirstFilter;
import cn.edu.gzist.chapter03.web.FirstListener;
import cn.edu.gzist.chapter03.web.FirstServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


// 第一种方式 Spring Bean
//@Configuration
public class ServletConfig {

    @Bean("first")
    public FirstServlet firstServlet() {
        return new FirstServlet();
    }

    // Bean的名称默认为方法名，必须符合驼峰命名法
    @Bean
    public FirstServlet firstServlet2() {
        return new FirstServlet();
    }

    @Bean
    public FirstFilter firstFilter(){
        return new FirstFilter();
    }
    @Bean
    public FirstListener firstListener(){
        return new FirstListener();
    }
}
